package cc.facesign.admin.enums;

import cc.facesign.common.exception.FacesignException;
import cc.facesign.common.utils.bean.R;

/**
 * Tbl_conf 表中 status 字段的阐述
 */
public enum ConfStatusType {
    ZERO(0, "没有审核"),
    ONE(1, "审核通过"),
    TWO(2, "审核不通过"),
    THREE(3, "正在进行"),
    FORE(4, "已结束");

    private final Integer code;
    private final String msg;

    private ConfStatusType(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static String codeOf(Integer code) {
        for (ConfStatusType e : values()) {
            if (code.equals(e.code)) {
                return e.msg;
            }
        }

        throw new FacesignException(R.ERROR, "状态码异常");
    }
}
